fix memory leak of MMacro::iname#65
Open
sorokin wants to merge 2 commits intonetwide-assembler:masterfrom
Open
fix memory leak of MMacro::iname#65sorokin wants to merge 2 commits intonetwide-assembler:masterfrom
sorokin wants to merge 2 commits intonetwide-assembler:masterfrom
Conversation
73d6e96 to
1f5a922
Compare
1f5a922 to
d165aa8
Compare
asm/preproc.c predominantly uses spaces, but these three lines use tabs. Signed-off-by: Ivan Sorokin <vanyacpp@gmail.com>
When running with -fsanitize=leak enabled nasm prints this error:
Direct leak of 25 byte(s) in 5 object(s) allocated from:
#0 0x7f5fc494b867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
netwide-assembler#1 0x55a8037f10e0 in nasm_malloc nasmlib/alloc.c:55
netwide-assembler#2 0x55a8037f10e0 in nasm_strdup nasmlib/alloc.c:117
netwide-assembler#3 0x55a803873172 in expand_mmacro asm/preproc.c:6905
netwide-assembler#4 0x55a803873172 in pp_tokline asm/preproc.c:7814
netwide-assembler#5 0x55a803873172 in pp_getline asm/preproc.c:7826
netwide-assembler#6 0x55a8037eb5d8 in assemble_file asm/nasm.c:1722
netwide-assembler#7 0x55a8037e5761 in main asm/nasm.c:719
netwide-assembler#8 0x7f5fc4063d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
netwide-assembler#9 0x7f5fc4063e3f in __libc_start_main_impl ../csu/libc-start.c:392
netwide-assembler#10 0x55a8037e7c34 in _start (/home/ivan/d/nasm/nasm+0x2e5c34)
This is reproducible on many tests, for example on zerobyte.asm.
The problem was that MMacro::iname is only allocated but never freed.
Signed-off-by: Ivan Sorokin <vanyacpp@gmail.com>
d165aa8 to
4666553
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix memory leak of
MMacro::inameWhen running with
-fsanitize=leakenabled nasm prints this error:This is reproducible on many tests, for example on
zerobyte.asm.The problem was that
MMacro::inameis only allocated but never freed.